package Laci.hibernate;

import entities.UserEntity;
import org.hibernate.*;

import java.util.Iterator;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Laci
 * Date: 2012.10.10.
 * Time: 16:06
 * To change this template use File | Settings | File Templates.
 */
public class GetUser {


    public int queryUser(){
              SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
        Session session=sessionFactory.openSession();
        Transaction transaction=session.getTransaction();
        transaction.begin();
        SQLQuery sqlQuery=session.createSQLQuery("select * from Users");
        //session.save(new UserEntity(3,"fsd","fsf","fsfs",5));
        transaction.commit();

          return sqlQuery.list().size();

    }

}
